package com.grupoconstruobras.sigo.exhumaciones.ui.datamodel;

import javax.persistence.EntityManager;

public class NativeDataModelFactory implements IDataModelFactory<Object[]> {

	private IQueryBuilder builder;
	
	public NativeDataModelFactory(EntityManager entityManager, IQueryBuilder builder) {
		this.builder = builder;
		builder.setEntityManager(entityManager);
	}
	
	@Override
	public ExtendedDataModel<Object[]> newInstance(IDataModelCallback<Object[]> callback, Object ... parameters) {
		builder.setParameters(parameters);
		return new NativeDataModel(callback, builder);
	}
	
	@Override
	public ExtendedDataModel<Object[]> newInstance(Object ... parameters) {
		builder.setParameters(parameters);
		return new NativeDataModel(builder);
	}
	
}